<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="p" uri="/pagination-tags"%>
<%@ taglib prefix="sj" uri="/struts-jquery-tags"%>
<%@ taglib prefix="security" uri="/security-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
&nbsp;
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title><s:property value="titleName"/>查询</title>

</head>
<body> 
<div id="breadcrumbs">
	<div><div><ul>
		<li class="first"></li>
		<li><a href="#">入库数据</a></li>
		<li><a href="#">入库管理</a></li>
		<li class="last"><a href="#"><s:property value="titleName"/>查询</a></li>
	</ul></div></div>
</div>

<%@include file="searchAsnHeaderInc.jsp"%>	



<script type="text/javascript">
//删除
function delForm(id){
	if (!confirm("确定要删除吗？")){
		return;
	}
	window.location.href = "${dynamicURL}/goods/deleteAsnHeader.action?goodsAsnHeader.id="+id;
}

//删除
function updateForm(id){
	document.getElementById('searchForm').onsubmit=function(){ return false; };
	window.location.href = "${dynamicURL}/asn/updateAsnHeader.action?asnHeader.id="+id;
}

$(document).ready(function (){  
		//--------------------------------------角色包含角色-------------------------------------------------
		var roleInRoleGridList;
		var roleId = document.getElementById('thisroleid').value;
		
		roleInRoleGridList = {   
				url: 'searchAsnHeaderJson.action?asnHeader.id='+roleId,
				colNames: ['id','入库单号', '类型', '供应商代码','供应商名称','门店代码','状态','产品数量','金额','创建人','审核人','审核时间','过账人','过账时间','操作'],
			colModel: [
				        {name:'id',index:'id', frozen:true, align:"left", hidden:true},
				        {name:'seqNo',index:'seqNo', frozen:true, align:"left"},
						{name:'type',index:'type', frozen:true, align:"left",formatter:asn_type},
				   		{name:'supplierCode',index:'supplierCode', align:"left"},
				   		{name:'supplierName',index:'supplierName', align:"left", width: '200'}, 						   		
				   		{name:'storeCode',index:'storeCode', align:"center"},
				   		{name:'status',index:'status', align:"center",formatter:satus_type},
				   		{name:'actualQuantify',index:'actualQuantify', align:"center",width: '60'},
				   		{name:'actualAmount',index:'actualAmount', align:"center",width: '60'},
				   		{name:'creator',index:'creator', align:"center",width: '60'},
				   		{name:'auditor',index:'auditor', align:"center",width: '60'},
				   		{name:'auditTime',index:'auditTime', align:"center",width: '60'},
				   		{name:'accountant',index:'accountant', align:"center",width: '60'},
				   		{name:'accoutTime',index:'accoutTime', align:"center",width: '60'},				   		
				   		{name:'btn',index:'btn',align:"center"}
				   	], 
		   	shrinkToFit: false,
				height: 260,
				width: 700,
				rowNum: 20,
				rownumbers: true,
				caption: '入库单列表',
				pager: '#roleInRolePager',
				jsonReader:{
					root:"pager.records",
					total: "total",
					page: "page",
					records: "records",
					repeatitems: false,
					id:"0" },
				gridComplete: function() {
				        var grid = jQuery("#roleInRoleList");
				        var ids = grid.jqGrid('getDataIDs');	// 获取表格所有 行id
				        for (var i = 0; i < ids.length; i++) {
				            var rowId = ids[i];
				            var rowdata = grid.jqGrid('getRowData', rowId);
				            var tempBtn = "<img title='添加库存' style='cursor:pointer' border='0'  src='${staticURL}/default/images/add.png' onclick='updateForm("+rowdata.id+")'>";  
				            grid.jqGrid('setRowData', rowId, { btn: tempBtn}); 
				        } 
				    }
		};
		$("#roleInRoleList").jqGrid(roleInRoleGridList);
		$("#roleInRoleList").setGridWidth(jQuery("#roleInRoleListDiv").width() * 0.98);
		
		var STATUS_TYPE = {'1': '新建', '2': '已审核','3': '已过账','D':'删除','C':'取消'};
		function satus_type(cellvalue, options, rowObject) {
			return STATUS_TYPE[cellvalue];
		}
		
		//FRESH('F',"新建"),PASSED('P',"已审核"),ACCOUNT('A',"已过账"),DELETED('D',"删除"),CANCEL('C',"取消");
		
		var ANS_TYPE={10:'正常',20:'返回',30:'盘点',40:'报损'};
		function asn_type(cellvalue, options, rowObject) {
			return ANS_TYPE[cellvalue];
		}
		
});

</script>
</body>
</html>
